package org.bjou

class ShiroRole {
    
    String name
    //角色描述
    String roleDscp
    //角色类型
    Integer roleType

    static hasMany = [ users: ShiroUser, permissions: String ]
    static belongsTo = ShiroUser

    static constraints = {
        name(nullable: false, blank: false, unique: true)
        roleDscp(nullable: true, blank: true)
        roleType(nullable: true, blank: true)
    }
    
    static namedQueries = {
        findByUser {
            userId ->
            users {
                eq 'id', userId
            }
        }
    }
    
}
